import type { PageDto, CommonResult, CommonPage } from '@/models/request'
import type { ResourceDto } from '@/models/resource'
import request from '@/utils/request'
export function fetchList(params: PageDto) {
  return request<CommonPage<ResourceDto>>({
    url: '/returnReason/list',
    method: 'get',
    params: params,
  })
}

export function deleteReason(params: { ids: string }) {
  return request<CommonResult>({
    url: '/returnReason/delete',
    method: 'post',
    params: params,
  })
}

export function updateStatus(params: { ids: string; status?: 0 | 1 }) {
  return request<CommonResult>({
    url: '/returnReason/update/status',
    method: 'post',
    params: params,
  })
}

export function addReason(data: ResourceDto) {
  return request<CommonResult>({
    url: '/returnReason/create',
    method: 'post',
    data: data,
  })
}

export function getReasonDetail(id: number) {
  return request<CommonResult<ResourceDto>>({
    url: '/returnReason/' + id,
    method: 'get',
  })
}

export function updateReason(id: number, data: ResourceDto) {
  return request<CommonResult>({
    url: '/returnReason/update/' + id,
    method: 'post',
    data: data,
  })
}
